package com.atguigu.mall.mallorder.service;

import com.atguigu.common.to.mq.SeckillOrderTo;
import com.atguigu.mall.mallorder.vo.OrderConfirmVo;
import com.atguigu.mall.mallorder.vo.OrderSubmitVo;
import com.atguigu.mall.mallorder.vo.PayAsyncVo;
import com.atguigu.mall.mallorder.vo.SubmitOrderResponseVo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.atguigu.common.utils.PageUtils;
import com.atguigu.mall.mallorder.entity.OrderEntity;

import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author Fuc
 * @email leftbear@gmail.com
 * @date 2020-10-21 16:12:27
 */
public interface OrderService extends IService<OrderEntity> {

  PageUtils queryPage(Map<String, Object> params);

  /**
   * 订单确认页返回需要用的数据
   *
   * @return
   */
  OrderConfirmVo confirmOrder() throws ExecutionException, InterruptedException;

  /**
   * 创建订单
   *
   * @param vo
   * @return
   */
  SubmitOrderResponseVo submitOrder(OrderSubmitVo vo);

  /**
   * 关闭订单
   *
   * @param orderEntity
   */
  void closeOrder(OrderEntity orderEntity);

  /**
   * 支付宝异步通知处理订单数据
   *
   * @param asyncVo
   * @return
   */
  String handlePayResult(PayAsyncVo asyncVo);

  /**
   * 微信异步通知处理
   *
   * @param notifyData
   */
  String asyncNotify(String notifyData);

  /**
   * 按照订单号获取订单信息
   *
   * @param orderSn
   * @return
   */
  OrderEntity getOrderByOrderSn(String orderSn);

  /**
   * 创建秒杀单
   *
   * @param orderTo
   */
  void createSeckillOrder(SeckillOrderTo orderTo);
}
